package com.yanqu.road.utils.serialize;

public class Item {


    public static Item newInstance(String s) {
        Item item = new Item();
        String[] split = s.split("=");
        if (split.length == 2) {
            item.setId(Integer.parseInt(split[0]));
            item.setNum(Integer.parseInt(split[1]));
        }
        return item;
    }

    public static Item newInstance(String s, String regex) {
        Item item = new Item();
        String[] split = s.split(regex);
        if (split.length == 2) {
            item.setId(Integer.parseInt(split[0]));
            item.setNum(Integer.parseInt(split[1]));
        }
        return item;
    }
    private int id;
    private int num;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }
}
